package net.color4me.app.farmere.utils;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CookieStrUtil {
	public static Map<String, String> process(String str) {
		Map<String, String> maps = new HashMap<String, String>();
		Pattern pattern = Pattern.compile("([a-zA-Z]+)=([a-z0-9]+);");
		Matcher matcher = pattern.matcher(str);
		while (matcher.find()) {
			String name = matcher.group(1);
			String value = matcher.group(2);
			if (!value.equals("null"))
				maps.put(name, value);

		}
		return maps;
	}

	public static void main(String[] args) {
		String c = "alxn=0b2c4373fc805e15c4007fccb02d00aefc3106392ef0b93f; domain=.xiaonei.com; path=/; expires=Sun, 24-May-2009 17:17:09 GMT, xnticket=null; domain=.xiaonei.com; path=/; expires=Thu, 01-Dec-1994 16:00:00 GMT, xnemail=null; domain=.xiaonei.com; path=/; expires=Thu, 01-Dec-1994 16:00:00 GMT, xnpasswd=null; domain=.xiaonei.com; path=/; expires=Thu, 01-Dec-1994 16:00:00 GMT, societyguester=1f6723deb0c31f22764dd27dac4097f37; domain=.xiaonei.com; path=/";
		CookieStrUtil.process(c);
	}
}
